<include file="Public/right_chat_panel"/>
<php> D('Member')->need_login();</php>
<!--[if lt IE 8]>
<div class="alert alert-danger" style="margin-bottom: 0">您正在使用 <strong>过时的</strong> 浏览器. 是时候 <a target="_blank"
                                                                                                href="http://browsehappy.com/">更换一个更好的浏览器</a>
    来提升用户体验.
</div>
<![endif]-->

<php>
    $unreadMessage=D('Common/Message')->getHaventReadMeassageAndToasted(is_login());
</php>
<div id="nav_bar" class="nav_bar">
    <php>$logo = get_cover(modC('LOGO',0,'Config'),'path');
        $logo = $logo?$logo:'__ROOT__/Public/images/logo.png';
    </php>

    <a class="logo" href="{:U('Home/Index/index')}"><img src="{$logo}"/></a>

    <div class="container">

        <nav class=" navbar-static-top" id="nav_bar_container" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">打开下拉菜单</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

            </div>
            <div class="collapse navbar-collapse " id="nav_bar_main">
                <form class="navbar-form navbar-left" style="max-width: 500px" role="search">
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="搜微博、会员">
                        <span class="input-group-addon"><i class="icon icon-search"></i></span>
                    </div>
                    </span>
                </form>
                <ul class="nav navbar-nav navbar-right">


                    <!--登陆面板-->
                    <if condition="is_login()">
                        <li class="dropdown  hidden-xs hidden-sm">
                            <div></div>
                            <a id="nav_info" class="dropdown-toggle text-left" data-toggle="dropdown">
                                <span class="icon-bell-alt"></span> 消息
                                <span id="nav_bandage_count"
                                <if condition="count($unreadMessage) eq 0"> style="display: none"</if>
                                class="label label-badge label-success">{:count($unreadMessage)}</span>
                                &nbsp;
                            </a>
                            <ul class="dropdown-menu extended notification">
                                <li>
                                    <div class="clearfix header">
                                        <div class="col-xs-6 nav_align_left"><span
                                                id="nav_hint_count">{:count($unreadMessage)}</span> 条未读
                                        </div>
                                    </div>
                                </li>
                                <li class="info-list">
                                    <div class="list-wrap">
                                        <ul id="nav_message" class="dropdown-menu-list scroller  list-data"
                                            style="width: auto;">
                                            <if condition="count($unreadMessage) eq 0">
                                                <div style="font-size: 18px;color: #ccc;font-weight: normal;text-align: center;line-height: 150px">
                                                    暂无任何消息!
                                                </div>
                                                <else/>
                                                <volist name="unreadMessage" id="message">
                                                    <li>
                                                        <a data-url="{$message.url}"
                                                           onclick="Notify.readMessage(this,{$message.id})">
                                                            <i class="icon-bell"></i>
                                                            {$message.title}
                                            <span class="time">
                                            {$message.ctime}
                                            </span>
                                                        </a>
                                                    </li>
                                                </volist>
                                            </if>

                                        </ul>
                                    </div>
                                </li>
                                <li class="footer text-right">
                                    <div class="btn-group">
                                        <button onclick="Notify.setAllReaded()" class="btn btn-sm  "><i
                                                class="icon-check"></i> 全部已读
                                        </button>
                                        <a class="btn  btn-sm  " href="{:U('ucenter/Message/message')}">
                                            查看消息
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a title="修改资料" href="{:U('ucenter/Config/index')}"><i
                                    class="icon-cog"></i> 设置</a>
                        </li>
                        <li class="top_spliter hidden-xs"></li>
                        <li class="dropdown">
                            <php>
                                $common_header_user = query_user(array('nickname'));
                            </php>
                            <a role="button" class="dropdown-toggle dropdown-toggle-avatar" data-toggle="dropdown">
                                {$common_header_user.nickname}&nbsp;<i style="font-size: 12px"
                                                                       class="icon-chevron-down"></i>
                            </a>
                            <ul class="dropdown-menu text-left" role="menu">
                                <li><a href="{:U('ucenter/Index/index')}"><span
                                        class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;个人主页</a>
                                </li>
                                <li><a href="{:U('ucenter/message/message')}"><span
                                        class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;消息中心</a>
                                </li>
                                <li><a href="{:U('ucenter/Collection/index')}"><span
                                        class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;我的收藏</a>
                                </li>

                            <li><a href="{:U('ucenter/Index/rank')}"><span
                                    class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;我的头衔</a>
                            </li>
                            <php>
                                $register_type=modC('REGISTER_TYPE','normal','Invite');
                                $register_type=explode(',',$register_type);
                                if(in_array('invite',$register_type)){
                            </php>
                            <li><a href="{:U('ucenter/Invite/invite')}"><span
                                class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;邀请好友</a>
                            </li>
                            <php>}</php>

                            {:hook('personalMenus')}
                            <if condition="is_administrator()">
                                <li><a href="{:U('Admin/Index/index')}" target="_blank"><span
                                        class="glyphicon glyphicon-dashboard"></span>&nbsp;&nbsp;管理后台</a></li>
                            </if>
                            <li><a event-node="logout"><span
                                    class="glyphicon glyphicon-off"></span>&nbsp;&nbsp;注销</a>
                            </li>
                        </ul>
                    </li>
                    <li class="top_spliter hidden-xs"></li>
                    <else/>


                    <li class="top_spliter hidden-xs"></li>
                    <php>
                        $open_quick_login=modC('OPEN_QUICK_LOGIN', 0, 'USERCONFIG');
                        $register_type=modC('REGISTER_TYPE','normal','Invite');
                        $register_type=explode(',',$register_type);
                        $only_open_register=0;
                        if(in_array('invite',$register_type)&&!in_array('normal',$register_type)){
                        $only_open_register=1;
                        }
                    </php>
                    <script>
                        var OPEN_QUICK_LOGIN = "{$open_quick_login}";
                        var ONLY_OPEN_REGISTER="{$only_open_register}";
                    </script>
                    <li class="hidden-xs">
                        <a data-login="do_login">登录</a>
                    </li>
                    <li class="hidden-xs">
                        <a data-role="do_register" data-url="{:U('Ucenter/Member/register')}">注册</a>
                    </li>
                    <li class="spliter hidden-xs"></li>

                </if>
            </ul>

            </div>

            <!--导航栏菜单项-->

        <div class="row visible-xs">
            <div class="navbar-header col-xs-3 pull-right text-left">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#nav_bar_main">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>

                </button>
            </div>
        </div>
        <!--举报插件钩子-->
        {:hook('report',array('type'=>'home','data'=>数组,'url'=> 'home/index/index.html'))}
        <!--举报插件钩子-->


        </nav>
    </div>

</div>


<!--换肤插件钩子-->
{:hook('setSkin')}
<!--换肤插件钩子 end-->
<a id="goTopBtn"></a>
<php>
    if(is_login()&&(get_login_role_audit()==2||get_login_role_audit()==0)){
</php>
<div class="alert alert-danger" style="margin-bottom: 0">您当前登录的 <strong>角色</strong>还未通过审核或被禁用。
    <a target="_blank" href="{:U('ucenter/config/role')}">更换其它角色登录</a>
</div>
<php>
    }
</php>


<div id="slider" class="slide-bar ">

    <ul class="app-menu ">
        <think:nav name="nav">
            <eq name="nav.pid" value="0">
                <php>
                    $children=D('Channel')->where(array('pid'=>$nav['id']))->order('sort asc')->select();
                    if($children){
                </php>
                <li class="dropdown">
                    <a class="dropdown-toggle nav_item" data-toggle="dropdown" href="#"><i
                            class="icon-{$nav.icon} app-icon" style="background: {$nav.color|default='#666'}"></i>

                        {$nav.title} <span class="caret"></span>
                        <neq name="nav.band_text" value="">

                            <span class="label label-badge"
                                  style="background: {$nav.band_color}">{$nav.band_text}</span>
                        </neq>
                    </a>
                    <ul class="dropdown-menu">
                        <volist name="children" id="subnav">
                            <li role="presentation"><a role="menuitem" tabindex="-1"
                                                       style="color:{$subnav.color}"
                                                       href="{$subnav.url|get_nav_url}"
                                                       target="<eq name='subnav.target' value='1'>_blank<else/>_self</eq>">{$subnav.title}
                                <neq name="subnav.band_text" value=""><span class="badge"
                                                                            style="background: {$subnav.band_color}">{$subnav.band_text}</span>
                                </neq>
                            </a>
                            </li>
                        </volist>
                    </ul>
                </li>
                <php>}else{</php>
                <li class="<eq name='nav.url|get_nav_active' value='1'>active<else/></eq>">
                    <a href="{$nav.url|get_nav_url}"
                       target="<eq name='nav.target' value='1'>_blank<else/>_self</eq>"><i
                            class="icon-{$nav.icon} app-icon" style="background: {$nav.color|default='#666'}"></i>
                        {$nav.title}
                        <neq name="nav.band_text" value=""><span class="label label-badge "
                                                                 style="background: {$nav.band_color}">{$nav.band_text}</span>
                        </neq>
                    </a>
                </li>
                <php>}</php>
            </eq>
        </think:nav>
        <li class=""><a onclick="toggleSlider()" class="pull-right"><i class="icon-resize-small"></i> </a></li>
    </ul>

    <ul class="app-menu app-menu-mini hidden">
        <think:nav name="nav">
            <eq name="nav.pid" value="0">
                <php>
                    $children=D('Channel')->where(array('pid'=>$nav['id']))->order('sort asc')->select();
                    if($children){
                </php>
                <li class="dropdown">
                    <a title="{$nav.title}" class="dropdown-toggle nav_item" data-toggle="dropdown" href="#"><i
                            class="icon-{$nav.icon} app-icon" style="background: {$nav.color|default='#666'}"></i>
                    </a>
                    <ul class="dropdown-menu">
                        <volist name="children" id="subnav">
                            <li role="presentation"><a role="menuitem" tabindex="-1"
                                                       style="color:{$subnav.color}"
                                                       href="{$subnav.url|get_nav_url}"
                                                       target="<eq name='subnav.target' value='1'>_blank<else/>_self</eq>">{$subnav.title}
                            </a>
                            </li>
                        </volist>
                    </ul>
                </li>
                <php>}else{</php>
                <li class="<eq name='nav.url|get_nav_active' value='1'>active<else/></eq>">
                    <a title="{$nav.title}" href="{$nav.url|get_nav_url}"
                       target="<eq name='nav.target' value='1'>_blank<else/>_self</eq>"><i
                            class="icon-{$nav.icon} app-icon" style="background: {$nav.color|default='#666'}"></i>
                    </a>
                </li>
                <php>}</php>
            </eq>
        </think:nav>
        <li class="pull-out">
            <a onclick="toggleSlider()"><i class="icon-fullscreen"></i> </a>
        </li>


        <script>
            var flag = 1;
            function toggleSlider() {
                $('#slider .app-menu').toggleClass('hidden');
                $('#slider').toggleClass('slide-bar-mini');
                if (flag == 1) {
                    //执行方法;
                    $.cookie('slider','hide');
                    $('#slider').css('margin-top', -($('#slider').height() / 2 + $('#nav_bar').height() / 2));
                    flag = 0;
                } else {
                    $.cookie('slider','show');
                    //执行方法;
                    $('#slider').css('margin-top',0);
                    flag = 1;
                }
            }

        </script>
       <if condition="cookie('slider') eq 'hide'">
           <script>
               toggleSlider();
           </script>

       </if>
    </ul>
</div>
